-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Suggest returning local on "expected ty
, found ()
" due to expr-less block
#98784
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Suggest returning local on "expected ty
, found ()
" due to expr-less block
#98784
Conversation
This comment has been minimized.
This comment has been minimized.
err.span_suggestion_verbose( | ||
span_semi, | ||
"consider removing this semicolon and boxing the expression", | ||
"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preexisting: This stands out to me. I guess we didn't have the statement span without the semicolon to suggest Box::new(
before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix that -- we should be able to strip the semicolon and provide a full suggestion (MaybeIncorrect, still) to box it
5bd41c5
to
a697665
Compare
@rustbot author |
☔ The latest upstream changes (presumably #99078) made this pull request unmergeable. Please resolve the merge conflicts. |
…k-compatible, r=estebank Do not call `check_expr` in `check_compatible`, since it has side-effects Fixes a weird suggestion in rust-lang#98784 found later: Fixes rust-lang#98894 Fixes rust-lang#98897
a697665
to
bc64fb0
Compare
@rustbot ready this is ready for another round of review i think, fixed the whitespace issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
bc64fb0
to
b0a8190
Compare
@bors r=estebank |
Rollup of 5 pull requests Successful merges: - rust-lang#98784 (Suggest returning local on "expected `ty`, found `()`" due to expr-less block) - rust-lang#98916 (Windows: Use `FindFirstFileW` for getting the metadata of locked system files) - rust-lang#99433 (Erase regions before comparing signatures of foreign fns.) - rust-lang#99452 (int_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc) - rust-lang#99481 (Add regression test for rust-lang#71547) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Putting this up for initial review. Notably, this doesn't consider if the value has possibly been moved, or whether the type is
Copy
. It also provides a structured suggestion if there's one "preferred" binding that matches the type (i.e. one binding in the block or its parent), otherwise it just points them out if there's fewer than 4 of them.Fixes #98177
r? @estebank